package com.wydstation.power.properties.repository;

import com.wydstation.power.properties.dto.address.AddressInfo;
import com.wydstation.power.properties.util.UniqueIDUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.r2dbc.core.DatabaseClient;
import org.springframework.stereotype.Repository;
import reactor.core.publisher.Mono;

import java.util.Collection;

@Repository
public class CommonRepository<T> {
    @Autowired
    private DatabaseClient databaseClient;

    public Mono insert(Class clazz, T t)  {
        databaseClient.insert().into(clazz).using(t).then().block();
        return Mono.empty();
    }

    public Mono insertBatch(Class clazz, Collection<T> t)  {
        databaseClient.insert().into(clazz).using(t).then().block();
        return Mono.empty();
    }

}
